org.springframework.web.servlet.mvc

Class CancellableFormController

    • Field Detail

      • PARAM_CANCEL

        private static final java.lang.String PARAM_CANCEL
        Deprecated. 
        Default parameter triggering the cancel action. Can be called even with validation errors on the form.
        See Also:
        Constant Field Values
      • cancelParamKey

        private java.lang.String cancelParamKey
        Deprecated. 
      • cancelView

        private java.lang.String cancelView
        Deprecated. 
    • Constructor Detail

      • CancellableFormController

        public CancellableFormController()
        Deprecated. 
    • Method Detail

      • setCancelParamKey

        public final void setCancelParamKey(java.lang.String cancelParamKey)
        Deprecated. 
        Set the key of the request parameter used to identify a cancel request. Default is "_cancel".

        The parameter is recognized both when sent as a plain parameter ("_cancel") or when triggered by an image button ("_cancel.x").

      • getCancelParamKey

        public final java.lang.String getCancelParamKey()
        Deprecated. 
        Return the key of the request parameter used to identify a cancel request.
      • setCancelView

        public final void setCancelView(java.lang.String cancelView)
        Deprecated. 
        Sets the name of the cancel view.
      • getCancelView

        public final java.lang.String getCancelView()
        Deprecated. 
        Gets the name of the cancel view.
      • isFormSubmission

        protected boolean isFormSubmission(HttpServletRequest request)
        Deprecated. 
        Consider an explicit cancel request as a form submission too.
        Overrides:
        isFormSubmission in class AbstractFormController
        Parameters:
        request - current HTTP request
        Returns:
        if the request represents a form submission
        See Also:
        #isCancelRequest(javax.servlet.http.HttpServletRequest)
      • suppressValidation

        protected boolean suppressValidation(HttpServletRequest request,
                                 java.lang.Object command)
        Deprecated. 
        Suppress validation for an explicit cancel request too.
        Overrides:
        suppressValidation in class SimpleFormController
        Parameters:
        request - current HTTP request
        command - the command object to validate
        Returns:
        whether to suppress validation for the given request
        See Also:
        #isCancelRequest(javax.servlet.http.HttpServletRequest)
      • isCancelRequest

        protected boolean isCancelRequest(HttpServletRequest request)
        Deprecated. 
        Determine whether the incoming request is a request to cancel the processing of the current form.

        By default, this method returns true if a parameter matching the configured cancelParamKey is present in the request, otherwise it returns false. Subclasses may override this method to provide custom logic to detect a cancel request.

        The parameter is recognized both when sent as a plain parameter ("_cancel") or when triggered by an image button ("_cancel.x").

        Parameters:
        request - current HTTP request
        See Also:
        setCancelParamKey(java.lang.String), PARAM_CANCEL
      • onCancel

        protected ModelAndView onCancel(HttpServletRequest request,
                            HttpServletResponse response,
                            java.lang.Object command)
                                 throws java.lang.Exception
        Deprecated. 
        Callback method for handling a cancel request. Called if isCancelRequest(HttpServletRequest) returns true.

        Default implementation delegates to onCancel(Object) to return the configured cancelView. Subclasses may override either of the two methods to build a custom ModelAndView that may contain model parameters used in the cancel view.

        If you simply want to move the user to a new view and you don't want to add additional model parameters, use setCancelView(String) rather than overriding an onCancel method.

        Parameters:
        request - current servlet request
        response - current servlet response
        command - form object with request parameters bound onto it
        Returns:
        the prepared model and view, or null
        Throws:
        java.lang.Exception - in case of errors
        See Also:
        #isCancelRequest(javax.servlet.http.HttpServletRequest), onCancel(Object), setCancelView(java.lang.String)
      • onCancel

        protected ModelAndView onCancel(java.lang.Object command)
                                 throws java.lang.Exception
        Deprecated. 
        Simple onCancel version. Called by the default implementation of the onCancel version with all parameters.

        Default implementation returns eturns the configured cancelView. Subclasses may override this method to build a custom ModelAndView that may contain model parameters used in the cancel view.

        If you simply want to move the user to a new view and you don't want to add additional model parameters, use setCancelView(String) rather than overriding an onCancel method.

        Parameters:
        command - form object with request parameters bound onto it
        Returns:
        the prepared model and view, or null
        Throws:
        java.lang.Exception - in case of errors
        See Also:
        #onCancel(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, Object), setCancelView(java.lang.String)